package collection1010;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class CollectionDemo {
    public static void main(String[] args) {
        Collection collection=new ArrayList();
        collection.add("233");
        collection.add(23);
        System.out.println(collection);
        collection.remove("233");
        System.out.println(collection);
        Collection collection1=new ArrayList();
        collection1.add("345");
        collection1.add(234);
        collection.addAll(collection1);
        Iterator iterator = collection.iterator();
        while (iterator.hasNext()){
            Object next = iterator.next();
            System.out.println(next);
        }
        System.out.println(collection);
        collection.removeAll(collection1);
        collection.retainAll(collection1);
        System.out.println(collection);
    }
}
